# fade_in_out.py
import pylab as pl
import numpy as np
from scipy.io import wavfile
samplerate, data = wavfile.read('E:/student_repo_036/labs/lab06/wavfile/10s.wav')

#%% fade in, fade out
N = data.shape[0]
M = N // 2
win_left = np.linspace(0, 2, N-M)
win_right =np.linspace(2, 0, N - M)
win = np.hstack((win_left, win_right))
print(win.shape)
data_windowed = data * win

# output as wavefile
pl.plot(data)